from clone import clone_file
from get_link import get_link
import time
from tqdm import tqdm

languages = ['javascript']
file_end_logo = {
    # 'python': ['.py'],
    # 'java': ['.java'],
    'javascript': ['.vue', 'js', 'ts', 'jsx', 'tsx']
}
page_max = 2
page_size = 100

link_list_total = []

error_link_list = []

for language in languages:
    end_logo_list = file_end_logo[language]
    for page in tqdm(range(page_max)):
        try:
            link_list = get_link(page, page_size, language)
            for link in link_list:
                if clone_file(link, end_logo_list) != 0:
                    error_link_list.append(link)
                time.sleep(0.3)
        except Exception as e:
            print(e)
